<?php

namespace app\common\validate\Hotel;

// 引入Thinkphp底层的验证器
use think\Validate;

/**
 * 定义入住人验证器
 */
class Guest extends Validate{
    // 设置我们要验证的字段规则
    protected $rule = [
        'busid' => ['require'],
        'mobile' => ['require','regex:/(^1[3|4|5|7|8|9][0-9]{9}$)/'],
        'nickname' => ['require'],
        'sex' => ['require','in:1,2']
    ];

    /**
     * 设置错误的提示信息
     */
    protected $message = [
        'busid.require' => '用户未知',
        'mobile.require' => '手机号必填',
        'mobile.regex' => '手机号码格式不正确',
        'nickname.require' => '入住人姓名必填',
        'sex.require' => '性别必填',
        'sex.in' => '性别未知'
    ];

    /**
     * 设置验证器的场景
     */
    protected $scene = [
    ];
}

?>
